home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / c_course.zip / SQUARES.C < prev    next >
Text File  |  1989-12-30  |  512b  |  22 lines

  1. main()  /* This is the main program */
  2. {
  3. int x,y;
  4.  
  5.    for(x = 0;x <= 7;x++) {
  6.       y = squ(x);  /* go get the value of x*x */
  7.       printf("The square of %d is %d\n",x,y);
  8.    }
  9.  
  10.    for (x = 0;x <= 7;++x) 
  11.       printf("The value of %d is %d\n",x,squ(x));
  12. }
  13.  
  14. squ(in)  /* function to get the value of in squared */
  15. int in;
  16. {
  17. int square;
  18.  
  19.    square = in * in;
  20.    return(square);  /* This sets squ() = square */
  21. }
  22.